3.9 \(\int \frac{(c+d \sec (e+f x))^4}{a+b \cos (e+f x)} \, dx\)

Optimal. Leaf size=247 \[ \frac{d^2 \left (6 a^2 c^2-4 a b c d+b^2 d^2\right ) \tan (e+f x)}{a^3 f}+\frac{d (2 a c-b d) \left (2 a^2 c^2-2 a b c d+b^2 d^2\right ) \tanh ^{-1}(\sin (e+f x))}{a^4 f}+\frac{d^3 (4 a c-b d) \tanh ^{-1}(\sin (e+f x))}{2 a^2 f}+\frac{d^3 (4 a c-b d) \tan (e+f x) \sec (e+f x)}{2 a^2 f}+\frac{2 (a c-b d)^4 \tan ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{a+b}}\right )}{a^4 f \sqrt{a-b} \sqrt{a+b}}+\frac{d^4 \tan ^3(e+f x)}{3 a f}+\frac{d^4 \tan (e+f x)}{a f} \]

[Out]

(2*(a*c - b*d)^4*ArcTan[(Sqrt[a - b]*Tan[(e + f*x)/2])/Sqrt[a + b]])/(a^4*Sqrt[a - b]*Sqrt[a + b]*f) + (d^3*(4
*a*c - b*d)*ArcTanh[Sin[e + f*x]])/(2*a^2*f) + (d*(2*a*c - b*d)*(2*a^2*c^2 - 2*a*b*c*d + b^2*d^2)*ArcTanh[Sin[
e + f*x]])/(a^4*f) + (d^4*Tan[e + f*x])/(a*f) + (d^2*(6*a^2*c^2 - 4*a*b*c*d + b^2*d^2)*Tan[e + f*x])/(a^3*f) +
 (d^3*(4*a*c - b*d)*Sec[e + f*x]*Tan[e + f*x])/(2*a^2*f) + (d^4*Tan[e + f*x]^3)/(3*a*f)

________________________________________________________________________________________

Rubi [A]  time = 0.408512, antiderivative size = 247, normalized size of antiderivative = 1., number of steps used = 12, number of rules used = 8, integrand size = 25, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.32, Rules used = {2828, 2952, 2659, 205, 3770, 3767, 8, 3768} \[ \frac{d^2 \left (6 a^2 c^2-4 a b c d+b^2 d^2\right ) \tan (e+f x)}{a^3 f}+\frac{d (2 a c-b d) \left (2 a^2 c^2-2 a b c d+b^2 d^2\right ) \tanh ^{-1}(\sin (e+f x))}{a^4 f}+\frac{d^3 (4 a c-b d) \tanh ^{-1}(\sin (e+f x))}{2 a^2 f}+\frac{d^3 (4 a c-b d) \tan (e+f x) \sec (e+f x)}{2 a^2 f}+\frac{2 (a c-b d)^4 \tan ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{a+b}}\right )}{a^4 f \sqrt{a-b} \sqrt{a+b}}+\frac{d^4 \tan ^3(e+f x)}{3 a f}+\frac{d^4 \tan (e+f x)}{a f} \]

Antiderivative was successfully verified.

[In]

Int[(c + d*Sec[e + f*x])^4/(a + b*Cos[e + f*x]),x]

[Out]

(2*(a*c - b*d)^4*ArcTan[(Sqrt[a - b]*Tan[(e + f*x)/2])/Sqrt[a + b]])/(a^4*Sqrt[a - b]*Sqrt[a + b]*f) + (d^3*(4
*a*c - b*d)*ArcTanh[Sin[e + f*x]])/(2*a^2*f) + (d*(2*a*c - b*d)*(2*a^2*c^2 - 2*a*b*c*d + b^2*d^2)*ArcTanh[Sin[
e + f*x]])/(a^4*f) + (d^4*Tan[e + f*x])/(a*f) + (d^2*(6*a^2*c^2 - 4*a*b*c*d + b^2*d^2)*Tan[e + f*x])/(a^3*f) +
 (d^3*(4*a*c - b*d)*Sec[e + f*x]*Tan[e + f*x])/(2*a^2*f) + (d^4*Tan[e + f*x]^3)/(3*a*f)

Rule 2828

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))^(n_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> In
t[((a + b*Sin[e + f*x])^m*(d + c*Sin[e + f*x])^n)/Sin[e + f*x]^n, x] /; FreeQ[{a, b, c, d, e, f, m}, x] && Int
egerQ[n]

Rule 2952

Int[((g_.)*sin[(e_.) + (f_.)*(x_)])^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) +
 (f_.)*(x_)])^(n_), x_Symbol] :> Int[ExpandTrig[(g*sin[e + f*x])^p*(a + b*sin[e + f*x])^m*(c + d*sin[e + f*x])
^n, x], x] /; FreeQ[{a, b, c, d, e, f, g, n, p}, x] && NeQ[b*c - a*d, 0] && (IntegersQ[m, n] || IntegersQ[m, p
] || IntegersQ[n, p]) && NeQ[p, 2]

Rule 2659

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[(2*e)/d, Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3767

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3768

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> -Simp[(b*Cos[c + d*x]*(b*Csc[c + d*x])^(n - 1))/(d*(n -
 1)), x] + Dist[(b^2*(n - 2))/(n - 1), Int[(b*Csc[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1
] && IntegerQ[2*n]

Rubi steps

\begin{align*} \int \frac{(c+d \sec (e+f x))^4}{a+b \cos (e+f x)} \, dx &=\int \frac{(d+c \cos (e+f x))^4 \sec ^4(e+f x)}{a+b \cos (e+f x)} \, dx\\ &=\int \left (\frac{(a c-b d)^4}{a^4 (a+b \cos (e+f x))}+\frac{d (2 a c-b d) \left (2 a^2 c^2-2 a b c d+b^2 d^2\right ) \sec (e+f x)}{a^4}+\frac{d^2 \left (6 a^2 c^2-4 a b c d+b^2 d^2\right ) \sec ^2(e+f x)}{a^3}+\frac{d^3 (4 a c-b d) \sec ^3(e+f x)}{a^2}+\frac{d^4 \sec ^4(e+f x)}{a}\right ) \, dx\\ &=\frac{d^4 \int \sec ^4(e+f x) \, dx}{a}+\frac{(a c-b d)^4 \int \frac{1}{a+b \cos (e+f x)} \, dx}{a^4}+\frac{\left (d^3 (4 a c-b d)\right ) \int \sec ^3(e+f x) \, dx}{a^2}+\frac{\left (d^2 \left (6 a^2 c^2-4 a b c d+b^2 d^2\right )\right ) \int \sec ^2(e+f x) \, dx}{a^3}+\frac{\left (d (2 a c-b d) \left (2 a^2 c^2-2 a b c d+b^2 d^2\right )\right ) \int \sec (e+f x) \, dx}{a^4}\\ &=\frac{d (2 a c-b d) \left (2 a^2 c^2-2 a b c d+b^2 d^2\right ) \tanh ^{-1}(\sin (e+f x))}{a^4 f}+\frac{d^3 (4 a c-b d) \sec (e+f x) \tan (e+f x)}{2 a^2 f}+\frac{\left (d^3 (4 a c-b d)\right ) \int \sec (e+f x) \, dx}{2 a^2}-\frac{d^4 \operatorname{Subst}\left (\int \left (1+x^2\right ) \, dx,x,-\tan (e+f x)\right )}{a f}+\frac{\left (2 (a c-b d)^4\right ) \operatorname{Subst}\left (\int \frac{1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac{1}{2} (e+f x)\right )\right )}{a^4 f}-\frac{\left (d^2 \left (6 a^2 c^2-4 a b c d+b^2 d^2\right )\right ) \operatorname{Subst}(\int 1 \, dx,x,-\tan (e+f x))}{a^3 f}\\ &=\frac{2 (a c-b d)^4 \tan ^{-1}\left (\frac{\sqrt{a-b} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{a+b}}\right )}{a^4 \sqrt{a-b} \sqrt{a+b} f}+\frac{d^3 (4 a c-b d) \tanh ^{-1}(\sin (e+f x))}{2 a^2 f}+\frac{d (2 a c-b d) \left (2 a^2 c^2-2 a b c d+b^2 d^2\right ) \tanh ^{-1}(\sin (e+f x))}{a^4 f}+\frac{d^4 \tan (e+f x)}{a f}+\frac{d^2 \left (6 a^2 c^2-4 a b c d+b^2 d^2\right ) \tan (e+f x)}{a^3 f}+\frac{d^3 (4 a c-b d) \sec (e+f x) \tan (e+f x)}{2 a^2 f}+\frac{d^4 \tan ^3(e+f x)}{3 a f}\\ \end{align*}

Mathematica [B]  time = 3.63652, size = 526, normalized size = 2.13 \[ \frac{\frac{4 a d^2 \left (2 a^2 \left (9 c^2+d^2\right )-12 a b c d+3 b^2 d^2\right ) \sin \left (\frac{1}{2} (e+f x)\right )}{\cos \left (\frac{1}{2} (e+f x)\right )-\sin \left (\frac{1}{2} (e+f x)\right )}+\frac{4 a d^2 \left (2 a^2 \left (9 c^2+d^2\right )-12 a b c d+3 b^2 d^2\right ) \sin \left (\frac{1}{2} (e+f x)\right )}{\sin \left (\frac{1}{2} (e+f x)\right )+\cos \left (\frac{1}{2} (e+f x)\right )}-6 d \left (-a^2 b d \left (12 c^2+d^2\right )+4 a^3 c \left (2 c^2+d^2\right )+8 a b^2 c d^2-2 b^3 d^3\right ) \log \left (\cos \left (\frac{1}{2} (e+f x)\right )-\sin \left (\frac{1}{2} (e+f x)\right )\right )-6 d \left (a^2 b d \left (12 c^2+d^2\right )-4 a^3 c \left (2 c^2+d^2\right )-8 a b^2 c d^2+2 b^3 d^3\right ) \log \left (\sin \left (\frac{1}{2} (e+f x)\right )+\cos \left (\frac{1}{2} (e+f x)\right )\right )-\frac{24 (a c-b d)^4 \tanh ^{-1}\left (\frac{(a-b) \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{b^2-a^2}}\right )}{\sqrt{b^2-a^2}}+\frac{a^2 d^3 (a (12 c+d)-3 b d)}{\left (\cos \left (\frac{1}{2} (e+f x)\right )-\sin \left (\frac{1}{2} (e+f x)\right )\right )^2}-\frac{a^2 d^3 (a (12 c+d)-3 b d)}{\left (\sin \left (\frac{1}{2} (e+f x)\right )+\cos \left (\frac{1}{2} (e+f x)\right )\right )^2}+\frac{2 a^3 d^4 \sin \left (\frac{1}{2} (e+f x)\right )}{\left (\cos \left (\frac{1}{2} (e+f x)\right )-\sin \left (\frac{1}{2} (e+f x)\right )\right )^3}+\frac{2 a^3 d^4 \sin \left (\frac{1}{2} (e+f x)\right )}{\left (\sin \left (\frac{1}{2} (e+f x)\right )+\cos \left (\frac{1}{2} (e+f x)\right )\right )^3}}{12 a^4 f} \]

Warning: Unable to verify antiderivative.

[In]

Integrate[(c + d*Sec[e + f*x])^4/(a + b*Cos[e + f*x]),x]

[Out]

((-24*(a*c - b*d)^4*ArcTanh[((a - b)*Tan[(e + f*x)/2])/Sqrt[-a^2 + b^2]])/Sqrt[-a^2 + b^2] - 6*d*(8*a*b^2*c*d^
2 - 2*b^3*d^3 + 4*a^3*c*(2*c^2 + d^2) - a^2*b*d*(12*c^2 + d^2))*Log[Cos[(e + f*x)/2] - Sin[(e + f*x)/2]] - 6*d
*(-8*a*b^2*c*d^2 + 2*b^3*d^3 - 4*a^3*c*(2*c^2 + d^2) + a^2*b*d*(12*c^2 + d^2))*Log[Cos[(e + f*x)/2] + Sin[(e +
 f*x)/2]] + (a^2*d^3*(-3*b*d + a*(12*c + d)))/(Cos[(e + f*x)/2] - Sin[(e + f*x)/2])^2 + (2*a^3*d^4*Sin[(e + f*
x)/2])/(Cos[(e + f*x)/2] - Sin[(e + f*x)/2])^3 + (4*a*d^2*(-12*a*b*c*d + 3*b^2*d^2 + 2*a^2*(9*c^2 + d^2))*Sin[
(e + f*x)/2])/(Cos[(e + f*x)/2] - Sin[(e + f*x)/2]) + (2*a^3*d^4*Sin[(e + f*x)/2])/(Cos[(e + f*x)/2] + Sin[(e
+ f*x)/2])^3 - (a^2*d^3*(-3*b*d + a*(12*c + d)))/(Cos[(e + f*x)/2] + Sin[(e + f*x)/2])^2 + (4*a*d^2*(-12*a*b*c
*d + 3*b^2*d^2 + 2*a^2*(9*c^2 + d^2))*Sin[(e + f*x)/2])/(Cos[(e + f*x)/2] + Sin[(e + f*x)/2]))/(12*a^4*f)

________________________________________________________________________________________

Maple [B]  time = 0.09, size = 1066, normalized size = 4.3 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c+d*sec(f*x+e))^4/(a+b*cos(f*x+e)),x)

[Out]

-8/f/a/((a+b)*(a-b))^(1/2)*arctan((a-b)*tan(1/2*f*x+1/2*e)/((a+b)*(a-b))^(1/2))*b*c^3*d+12/f/a^2/((a+b)*(a-b))
^(1/2)*arctan((a-b)*tan(1/2*f*x+1/2*e)/((a+b)*(a-b))^(1/2))*b^2*c^2*d^2-8/f/a^3/((a+b)*(a-b))^(1/2)*arctan((a-
b)*tan(1/2*f*x+1/2*e)/((a+b)*(a-b))^(1/2))*b^3*c*d^3+2/f/((a+b)*(a-b))^(1/2)*arctan((a-b)*tan(1/2*f*x+1/2*e)/(
(a+b)*(a-b))^(1/2))*c^4-1/3/f*d^4/a/(tan(1/2*f*x+1/2*e)+1)^3-1/f*d^4/a/(tan(1/2*f*x+1/2*e)+1)+1/2/f*d^4/a/(tan
(1/2*f*x+1/2*e)+1)^2-1/3/f*d^4/a/(tan(1/2*f*x+1/2*e)-1)^3-1/f*d^4/a/(tan(1/2*f*x+1/2*e)-1)-1/2/f*d^4/a/(tan(1/
2*f*x+1/2*e)-1)^2-6/f*d^2/a/(tan(1/2*f*x+1/2*e)-1)*c^2+2/f*d^3/a/(tan(1/2*f*x+1/2*e)-1)*c-1/2/f*d^4/a^2/(tan(1
/2*f*x+1/2*e)-1)*b-1/f*d^4/a^3/(tan(1/2*f*x+1/2*e)-1)*b^2+2/f*d^3/a/(tan(1/2*f*x+1/2*e)-1)^2*c-1/2/f*d^4/a^2/(
tan(1/2*f*x+1/2*e)-1)^2*b+4/f*d/a*ln(tan(1/2*f*x+1/2*e)+1)*c^3+2/f*d^3/a*ln(tan(1/2*f*x+1/2*e)+1)*c-1/2/f*d^4/
a^2*ln(tan(1/2*f*x+1/2*e)+1)*b-1/f*d^4/a^4*ln(tan(1/2*f*x+1/2*e)+1)*b^3-6/f*d^2/a/(tan(1/2*f*x+1/2*e)+1)*c^2+2
/f*d^3/a/(tan(1/2*f*x+1/2*e)+1)*c-1/2/f*d^4/a^2/(tan(1/2*f*x+1/2*e)+1)*b-1/f*d^4/a^3/(tan(1/2*f*x+1/2*e)+1)*b^
2-2/f*d^3/a/(tan(1/2*f*x+1/2*e)+1)^2*c+1/2/f*d^4/a^2/(tan(1/2*f*x+1/2*e)+1)^2*b-4/f*d/a*ln(tan(1/2*f*x+1/2*e)-
1)*c^3-2/f*d^3/a*ln(tan(1/2*f*x+1/2*e)-1)*c+1/2/f*d^4/a^2*ln(tan(1/2*f*x+1/2*e)-1)*b+1/f*d^4/a^4*ln(tan(1/2*f*
x+1/2*e)-1)*b^3+4/f*d^3/a^3*ln(tan(1/2*f*x+1/2*e)+1)*b^2*c+4/f*d^3/a^2/(tan(1/2*f*x+1/2*e)+1)*b*c+6/f*d^2/a^2*
ln(tan(1/2*f*x+1/2*e)-1)*b*c^2-4/f*d^3/a^3*ln(tan(1/2*f*x+1/2*e)-1)*b^2*c+4/f*d^3/a^2/(tan(1/2*f*x+1/2*e)-1)*b
*c+2/f/a^4/((a+b)*(a-b))^(1/2)*arctan((a-b)*tan(1/2*f*x+1/2*e)/((a+b)*(a-b))^(1/2))*b^4*d^4-6/f*d^2/a^2*ln(tan
(1/2*f*x+1/2*e)+1)*b*c^2

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*sec(f*x+e))^4/(a+b*cos(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*sec(f*x+e))^4/(a+b*cos(f*x+e)),x, algorithm="fricas")

[Out]

Timed out

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\left (c + d \sec{\left (e + f x \right )}\right )^{4}}{a + b \cos{\left (e + f x \right )}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*sec(f*x+e))**4/(a+b*cos(f*x+e)),x)

[Out]

Integral((c + d*sec(e + f*x))**4/(a + b*cos(e + f*x)), x)

________________________________________________________________________________________

Giac [B]  time = 1.28761, size = 849, normalized size = 3.44 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*sec(f*x+e))^4/(a+b*cos(f*x+e)),x, algorithm="giac")

[Out]

1/6*(3*(8*a^3*c^3*d - 12*a^2*b*c^2*d^2 + 4*a^3*c*d^3 + 8*a*b^2*c*d^3 - a^2*b*d^4 - 2*b^3*d^4)*log(abs(tan(1/2*
f*x + 1/2*e) + 1))/a^4 - 3*(8*a^3*c^3*d - 12*a^2*b*c^2*d^2 + 4*a^3*c*d^3 + 8*a*b^2*c*d^3 - a^2*b*d^4 - 2*b^3*d
^4)*log(abs(tan(1/2*f*x + 1/2*e) - 1))/a^4 - 12*(a^4*c^4 - 4*a^3*b*c^3*d + 6*a^2*b^2*c^2*d^2 - 4*a*b^3*c*d^3 +
 b^4*d^4)*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(-2*a + 2*b) + arctan(-(a*tan(1/2*f*x + 1/2*e) - b*tan(1/2*f*x
+ 1/2*e))/sqrt(a^2 - b^2)))/(sqrt(a^2 - b^2)*a^4) - 2*(36*a^2*c^2*d^2*tan(1/2*f*x + 1/2*e)^5 - 12*a^2*c*d^3*ta
n(1/2*f*x + 1/2*e)^5 - 24*a*b*c*d^3*tan(1/2*f*x + 1/2*e)^5 + 6*a^2*d^4*tan(1/2*f*x + 1/2*e)^5 + 3*a*b*d^4*tan(
1/2*f*x + 1/2*e)^5 + 6*b^2*d^4*tan(1/2*f*x + 1/2*e)^5 - 72*a^2*c^2*d^2*tan(1/2*f*x + 1/2*e)^3 + 48*a*b*c*d^3*t
an(1/2*f*x + 1/2*e)^3 - 4*a^2*d^4*tan(1/2*f*x + 1/2*e)^3 - 12*b^2*d^4*tan(1/2*f*x + 1/2*e)^3 + 36*a^2*c^2*d^2*
tan(1/2*f*x + 1/2*e) + 12*a^2*c*d^3*tan(1/2*f*x + 1/2*e) - 24*a*b*c*d^3*tan(1/2*f*x + 1/2*e) + 6*a^2*d^4*tan(1
/2*f*x + 1/2*e) - 3*a*b*d^4*tan(1/2*f*x + 1/2*e) + 6*b^2*d^4*tan(1/2*f*x + 1/2*e))/((tan(1/2*f*x + 1/2*e)^2 -
1)^3*a^3))/f